﻿
using Microsoft.VisualStudio.TestTools.UnitTesting;

using MvcScriptManager.UniqueKeyEncoding;

namespace MvcScriptManager.Tests.UniqueKeyEncoding
{
	/// <summary>
	/// Tests the <see cref="UniqueKeyEncoderFactory"/> class
	/// </summary>
	[TestClass]
	public class UniqueKeyEncoderFactoryTests
	{
		/// <summary>
		/// Gets or sets the test context which provides
		/// information about and functionality for the current test run.
		/// </summary>
		public TestContext TestContext { get; set; }

		private UniqueKeyEncoderFactory factory;

		[TestInitialize]
		public void Initialize()
		{
			factory = new UniqueKeyEncoderFactory();
		}

		[TestMethod]
		public void TestGetEncoderForSchemeWithOneWayHash()
		{
			IUniqueKeyEncoder encoder = factory.GetEncoderForScheme(UniqueKeyEncodingScheme.OneWayHash);

			Assert.IsInstanceOfType(encoder, typeof(UniqueKeyOneWayHash));
		}

		[TestMethod]
		public void TestGetEncoderForSchemeWithTwoWayEncoding()
		{
			IUniqueKeyEncoder encoder = factory.GetEncoderForScheme(UniqueKeyEncodingScheme.TwoWayEncoding);

			Assert.IsInstanceOfType(encoder, typeof(UniqueKeyTwoWayEncoding));
		}
	}
}